package com.mdd.store.provider;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mdd.store.api.StoreApi;
import com.mdd.store.entity.Store;
import com.mdd.store.service.IStoreService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;

/**
 * @Description
 * @Author 幻速
 * @Date 2024/3/19 17:23
 **/
@Service
public class StoreApiProvider implements StoreApi {
    @Resource
    IStoreService iStoreService;
    @Override
    public boolean isExists(String storeId) {
        LambdaQueryWrapper<Store> lQWrapper=new LambdaQueryWrapper<>();
        lQWrapper.eq(Store::getId,storeId);
        return iStoreService.count(lQWrapper)>0;
    }

    @Override
    public String getDeptCode(String storeId) {
        LambdaQueryWrapper<Store> lQWrapper=new LambdaQueryWrapper<>();
        lQWrapper.eq(Store::getId,storeId);
        Store store = iStoreService.getOne(lQWrapper);
        return store!=null?store.getDeptCode():null;
    }
}
